/**
 * 
 */
package it.unitn.testbed.client.common;

import java.io.Serializable;

/**
 * The configuration for a mote created from the XML descriptor of the
 * configuration. The configuration contains data required for flashing a mote
 * and received serial packets from the mote. A description of these can be
 * found in {@link MoteConfig#MoteConfig(Integer, String, String)}.
 * 
 * Three possible ways of flashing a mote exist:
 * <ul>
 * <li>In the case the mote is attached locally to the servlet container, then
 * {@link MoteConfig#source} will be something like "/dev/ttyUSB0".
 * <li>In the case the mote is attached to a serial forwarder, then
 * {@link MoteConfig#source} will be something like "192.168.1.33:9001".
 * <li>In the case the mote is to be programmed via SSH, then {@link #source}
 * will be something like "/dev/ttyUSB0@192.168.1.33". For this target, the
 * commands used to stop and start the SerialForwarder before and after the
 * actual flash operation should be given by {@link MoteConfig#sshSFStop} and
 * {@link MoteConfig#sshSFStart}.
 * </ul>
 * 
 * @author Stefan Guna
 * @see it.unitn.testbed.server.task.FlashThread
 * 
 */
public class MoteConfig implements Serializable {
	private static final long serialVersionUID = 1L;

	private Integer id;
	private String serialFw;
	private String source;
	private String sshSFStart;
	private String sshSFStop;

	@SuppressWarnings("unused")
	private MoteConfig() {
	}

	/**
	 * Creates a new mote object.
	 * 
	 * @param id
	 *            Id of the mote
	 * @param source
	 *            The source where the mote is located to be programmed. It can
	 *            be "host:port" if Serial Forwarder is used to program the
	 *            mote, "com_port" if plain bsl is used to program a mote
	 *            attached locally or "com_port@host" if SSH and bsl is used to
	 *            program remotely a mote
	 * @param serialFw
	 *            The address where the serial forwarder for this mote is
	 *            connected to.
	 */
	public MoteConfig(Integer id, String source, String serialFw) {
		this.id = id;
		this.source = source;
		this.serialFw = serialFw;
	}

	/**
	 * @return the id
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @return the serialFw
	 */
	public String getSerialFw() {
		return serialFw;
	}

	/**
	 * @return the source
	 */
	public String getSource() {
		return source;
	}

	/**
	 * @return the sshSFStart
	 */
	public String getSshSFStart() {
		return sshSFStart;
	}

	/**
	 * @return the sshSFStop
	 */
	public String getSshSFStop() {
		return sshSFStop;
	}

	/**
	 * @param sshSFStart
	 *            the sshSFStart to set
	 */
	public void setSshSFStart(String sshSFStart) {
		this.sshSFStart = sshSFStart;
	}

	/**
	 * @param sshSFStop
	 *            the sshSFStop to set
	 */
	public void setSshSFStop(String sshSFStop) {
		this.sshSFStop = sshSFStop;
	}
}
